<template>
  <div class="bottom-menu">
    <check-button
      class="select-all"
      @click.native="btnClick"
      :checked="isCheckAll"
    />
    <span>全选</span>
    <span class="total-price">合计:¥{{ this.total.toFixed(2) }}</span>
    <div class="right">
      <span class="buy-product">付款</span>
      <span class="del-product" @click="delGoods">删除</span>
    </div>
  </div>
</template>

<script>
import CheckButton from "./CheckButton";

import { mapGetters, mapMutations } from "vuex";
export default {
  name: "MarketBottomBar",
  components: {
    CheckButton
  },
  computed: {
    ...mapGetters(["isCheckAll", "selectedProductsLength", "total"])
  },
  methods: {
    ...mapMutations(["selectAll", "delGoods"]),
    btnClick() {
      //如果全选按钮选中了  那所有的按钮都应该选中
      this.selectAll(!this.isCheckAll);
    }
  }
};
</script>

<style lang="less" scoped>
.bottom-menu {
  width: 100%;
  height: 44px;
  background-color: #eee;
  position: absolute;
  bottom: 0px;
  left: 0;
  right: 0;
  box-shadow: 0 -2px 3px rgba(0, 0, 0, 0.2);
  font-size: 14px;
  color: #888;
  line-height: 44px;
  padding-left: 35px;
  box-sizing: border-box;
}

.bottom-menu .select-all {
  position: absolute;
  line-height: 0;
  display: flex;
  left: 12px;
  top: 13px;
}

.bottom-menu .total-price {
  margin-left: 15px;
  font-size: 16px;
  color: #666;
}
.right {
  float: right;
}
.right span {
  display: inline-block;
  width: 80px;
}
.right .buy-product {
  background-color: #ff5777;
  color: #fff;

  height: 44px;
  text-align: center;
  line-height: 44px;
}
.right .del-product {
  background-color: rgb(201, 191, 191);
  color: #fff;
  height: 44px;
  text-align: center;
  line-height: 44px;
}
</style>
